<?php

class Form extends Controller {

 function __construct()
    {
        parent::Controller();
        $this->load->model('Need_model');
    }

function index ()
    {
        $telefono = $this->input->post('telefono');
        if ($this->input->post('key')!="pirulinpirulao") exit();
        if ($this->Need_model->exists($telefono))
            {
                $this->Need_model->re_insert($telefono);
            }
        else
            {
                $this->Need_model->insert_new($telefono);
            }
        echo "OK";
    }

function html ()
   {
        $this->load->helper('form');
        $this->load->view('open_html');
        $this->load->view('form_view');
        $this->load->view('close_html');
   }

 
}
?>
